#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QPainter>
#include <QPen>
#include <QBrush>
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}
void Widget::paintEvent(QPaintEvent *event){
    QPainter painter(this);
    QPen pen(QColor(Qt::black));
    QBrush brush(QColor(Qt::white));
    painter.setPen(pen);
    painter.setBrush(brush);
    painter.drawRect(0,0,width()*2/3,height());//画矩形

    //
    brush.setColor(Qt::black);
    painter.setBrush(brush);
   painter.translate(ui->horizontalSlider->value(),ui->horizontalSlider->value());//平移
  painter.rotate(ui->horizontalSlider->value());
   painter.scale(ui->horizontalSlider->value()/33.0,ui->horizontalSlider->value()/33.0);//缩放比例0.0-3.0//浮点数精度更高
  painter.shear(ui->horizontalSlider->value()/99.0,ui->horizontalSlider->value()/99.0);//扭曲系数0.0-1.0；
   painter.drawRect(0,0,100,100);//
}
void Widget::on_horizontalSlider_actionTriggered(int action)
{
    update();
}
